/**
 * Tests creating and outputing in form of a list "list.txt" in root directory a
 * B+ Tree with random IDs and Attributes probably without colissions
 */
package bPlusTree;

import java.io.IOException;
import java.util.Random;

import register.Register;
import register.RegisterID;
import bplustree.BPlusTree;
import junit.framework.TestCase;

/**
 * @author ernesto
 *
 */
public class ListNoColissionsTest extends TestCase {

	/**
	 * @param arg0
	 */
	public ListNoColissionsTest(String arg0) {
		super(arg0);
	}

	/* (non-Javadoc)
	 * @see junit.framework.TestCase#setUp()
	 */
	protected void setUp() throws Exception {
		super.setUp();
	}

	/* (non-Javadoc)
	 * @see junit.framework.TestCase#tearDown()
	 */
	protected void tearDown() throws Exception {
		super.tearDown();
		
	}

	/**
	 * Test method for {@link bplustree.BPlusTree#list()}.
	 * @throws IOException 
	 */
	public void testList() throws IOException {
		BPlusTree arbol = new BPlusTree();
		Random randGenerator = new Random();
		
		for(int i=0,nextid; i<3000; i++ ){
			nextid=randGenerator.nextInt(1000000);
			//System.out.println("ID del registro a insertar = " + nextid);
			System.out.println("Insertando registro " + i + " de 3000");
			arbol.insert(new Register(new RegisterID(Integer.toString(nextid)),randGenerator.nextInt(200)));
		}
		System.out.println("Finalizada insercion, comenzando listado");
		arbol.list();
		arbol.finalize();
		
	}

}
